package com.yl.module.user.listener;

import com.yl.module.user.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEvent;

/**
 *
 * spring会自动将该事件注册到applicationContext中
 * 这里有通过构造方法将事件源传递进去，有些场景可以用到，本例子中的事件源是UserService
 * @Author jiangtao
 * @CreateBy 2020-06-08 3:52 PM
 * @UpdateBy jiangtao
 * @Version v1.0
 */
@Slf4j
public class UserRegisterEvent extends ApplicationEvent {

    private User user;

    private static final long serialVersionUID = 1L;

    public UserRegisterEvent(Object source) {
        super(source);
    }

    public UserRegisterEvent(Object source, User user) {
        super(source);
        this.user = user;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}
